Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve AttributeError: 'ScalaFunction1' object has no attribute 'hashCode'. #184

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

poolis
Copy link
Contributor

@poolis poolis commented Jan 3, 2024

Issue #, if available:
#91

Description of changes:
Added hashCode() method to ScalaFunction1 and ScalaFunction2.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

vrb.addCheck(check)
check.hasDataType("d", ConstrainableDataTypes.String, lambda x: x >= 1)
vrb.addCheck(check)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add and verify one by one?

Copy link
Contributor Author

@poolis poolis Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that is the use case for triggering the exception. If I change the test like so, it does not use hashCode.

        vrb = VerificationSuite(self.spark) \
            .onData(self.df)
        check = Check(self.spark, CheckLevel.Error, "Enough checks to trigger a hashCode not an attribute of ScalaFunction1")
        check.addConstraints([
            check.isComplete('b'),
            check.containsEmail('email'),
            check.isGreaterThanOrEqualTo("d", "b"),
            check.isLessThanOrEqualTo("b", "d"),
            check.hasDataType("d", ConstrainableDataTypes.String, lambda x: x >= 1)])

         result = vrb.addCheck(check).run()

Copy link
Contributor

@chenliu0831 chenliu0831 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it only fail at the magic 5th one? It's a big strange if so.. btw CI is failing on this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue write up has more info: #91

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't replicate the error in CI but submitted an attempt to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants